<extend name="Public/base" />
<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i class="icon-home"></i> 首页</a> 
			<a href="#" class="current">{$meta_title}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br/>
		<button class="btn btn-info" id="add_Ward" >新增行政区</button>
		<notempty name='_list'>
			<button class="confirm btn btn-danger ajax-post" url="{:U('Base/changeStatusWard?method=delete')}" target-form="ids">删除行政区</button>
		</notempty>
		<div class="search-form fr cf row-fluid" style="width:300px;">			
			<span class=" pull-right">
					<input type="text" name="search_text" class="search-input" value="{:htmlspecialchars(I('search_text'))}" placeholder="请输入行政区名称" style="margin-bottom:0;"><button class="btn btn-info" id="search_button" url="{$post_url}"><i class="icon-search icon-white"></i></button>
			</span>
		</div>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-content ">
						<form id="export-form" method="post" action="" autocomplete="off">
							<table class="table table-bordered table-striped with-check">
							<notempty name="_list">
								<thead>
									<tr>
										<th><input type="checkbox" /></th>
										<th nowrap="nowrap">序号</th>
										<th>行政区</th>
										<th>操作</th>
									</tr>
								</thead>
									<tbody>
										<volist name="_list" id="vo">
											<tr>
												<td class="taskStatus"><input type="checkbox" value="{$vo.ward_id}" name="id[]" class="ids"/></td>
												<td class="taskStatus">{$i}</td>
												<td class="taskStatus">{$vo.ward_name|htmlspecialchars}</a></td>
												<td class="taskStatus">
													<a href="{:U('Base/editWard?ward_id='.$vo['ward_id'])}"><i class="icon-edit"></i> 编辑</a>
													<a href="{:U('changeStatusWard',array('id'=>$vo['ward_id'],'method'=>'delete'))}" class="ajax-get confirm"><i class="icon-remove"></i> 删除</a>
												</td>
											</tr>
										</volist>
									</tbody>
								</table>
								<div class="dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_full_numbers" id="DataTables_Table_0_paginate">
									{$_page}
								</div>
						</form>
					<else/>
						<center>暂无内容</center>
					</notempty>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	
$(function (){
    var URL_AREA_WARD    = "{:U('Base/getWard')}";
    $("select.select2").select2();
    $("#j-select-city").change(function() {
        var city_id = $(this).val();
        get_ward(city_id);
    });

    function get_ward(city_id) {
        var $select = $("#j-select-ward")
        var html = "";
        $.ajax({
            "url": URL_AREA_WARD,
            "type": "GET",
            "dataType": "JSON",
            "data": {"city_id": city_id,"data_type": 1}
        }).done(function(json) {

            var data = json.data;
            for (k in data) {
                html += "<option value=\"" + data[k].ward_id + "\">" + data[k].ward_name + "</option>";
            }
            $select.html(html).select2();
        });
    };
	
	//新增行政区跳转页面
	$('#add_Ward').click(function(){
		window.location.href="{:U('Base/addWard?city_id='.$city_id)}";
	});
});
//导航高亮
highlight_subnav("{:U('Base/area')}");
</script>
</block>